package com.mxpio.webapp.entity;

import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 服务器进程表
 *
 * @author: Cheng
 * @date: 2022/10/31
 */
@Entity
@Table(name = "MI_MONITOR_SERVER_PROCESS")
@Schema(description = "服务器进程表")
@Data
@ToString
public class MonitorServerProcess extends BaseEntity {

    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;

    @Schema(description = "IP地址")
    @Column(name = "IP")
    private String ip;

    @Schema(description = "进程ID")
    @Column(name = "PROCESS_ID")
    private Integer processId;

    @Schema(description = "进程名")
    @Column(name = "NAME")
    private String name;

    @Schema(description = "执行进程的完整路径")
    @Column(name = "PATH")
    private String path;

    @Schema(description = "进程命令行")
    @Column(name = "COMMAND_LINE")
    private String commandLine;

    @Schema(description = "进程当前的工作目录")
    @Column(name = "CURRENT_WORKING_DIRECTORY")
    private String currentWorkingDirectory;

    @Schema(description = "用户名")
    @Column(name = "USER")
    private String user;

    @Schema(description = "进程执行状态")
    @Column(name = "STATE")
    private String state;

    @Schema(description = "进程已启动的毫秒数")
    @Column(name = "UP_TIME")
    private String upTime;

    @Schema(description = "进程的开始时间")
    @Column(name = "START_TIME")
    private Date startTime;

    @Schema(description = "进程的累积CPU使用率")
    @Column(name = "CPU_LOAD_CUMULATIVE")
    private Double cpuLoadCumulative;

    @Schema(description = "进程的位数")
    @Column(name = "BITNESS")
    private String bitness;

    @Schema(description = "占用内存大小（单位：byte）")
    @Column(name = "MEMORY_SIZE")
    private Long memorySize;
}
